Page({
  data: {
    isLike: true,
    // banner
    indicatorDots: true, //是否显示面板指示点
    autoplay: true, //是否自动切换
    interval: 3000, //自动切换时间间隔,3s
    duration: 1000,//	滑动动画时长1s
    imgUrls: [
      'https://img14.360buyimg.com/n1/jfs/t1/235202/14/21446/203156/667941ecF0676e0ae/9b264fbf62321e58.jpg.avif',
      'https://img14.360buyimg.com/n1/jfs/t1/102032/38/50166/184976/66bb13a5F81ec11de/8a4ae4a347480755.jpg.avif',
      'https://img14.360buyimg.com/n1/jfs/t1/150932/12/25257/208477/6651607fF6e6b0a01/c5c3dee02c1abd0c.jpg.avif',
      'https://img14.360buyimg.com/n1/jfs/t1/120406/15/32561/201494/642b832aFf7cad538/2fa86435eefd5f21.jpg.avif',
      'https://img14.360buyimg.com/n1/jfs/t1/160071/7/36029/69758/642b86fcFd2e20043/ec1295642be1aa9f.jpg.avif'
    ],


    // 商品详情介绍
    detailImg: [
      "https://img10.360buyimg.com/img/jfs/t1/229085/25/18326/209411/6657f6e7F51078c44/79acf45df1c1baf0.jpg",
      "https://img10.360buyimg.com/img/jfs/t1/235705/1/22636/177630/66ab4429F2504ddd8/055f987a3a3ddf7b.jpg",
      "https://img30.360buyimg.com/popWareDetail/jfs/t1/137802/40/35164/176871/642b875eFcc5c08da/3d9cc14508a49a1e.jpg",
      "https://img30.360buyimg.com/popWareDetail/jfs/t1/173764/22/30039/105949/642b875eF8f08af50/05cfd85fb951baf0.jpg",
      "https://img30.360buyimg.com/popWareDetail/jfs/t1/181592/6/34758/157841/642b875fF23733881/a4adb2c4144faec3.jpg",
      "https://img30.360buyimg.com/popWareDetail/jfs/t1/93322/4/37386/210418/642b875fF3436ca5a/a06781008e53b8ac.jpg",
    ],
  },
  //预览图片
  onLoad() {
    console.log(this.data.imgUrls); // 检查数据是否正常
  },
  previewImage(e) {
    wx.previewImage({
      current: e.currentTarget.dataset.src,
      urls: this.data.imgUrls

    })
  },
  // 收藏
  addLike() {
    this.setData({
      isLike: !this.data.isLike
    });
  },
  // 跳到购物车
  toCar() {
    wx.switchTab({
      url: '/pages/cart/cart'
    })
  },
  // 立即购买
  immeBuy() {
    wx.showToast({
      title: '购买成功',
      icon: 'success',
      duration: 2000
    });
  },
})
